package com.colin.aiyi.dao.ImpxUtils;

import com.colin.aiyi.app.Constant;
import com.colin.aiyi.entity.response.LoginResponse;
import com.colin.aiyi.entity.ResetPWRequest;

import org.xutils.http.RequestParams;

/**
 * Created by hl on 2017/6/9.
 */

public class ImpRestPWForget extends AbsServicexUtils {
    @Override
    public void onSuccess(String result) {
        super.onSuccess(result);
        LoginResponse loginResponse=gson.fromJson(result,LoginResponse.class);
        loginResponse.setMsgType(6);
        if (callback==null)
        {
            sendMsgToView(loginResponse);
        }else {
            callback.onSuccess(loginResponse);
        }
    }

    @Override
    public <V> void getObject(V v) {
        super.getObject(v);
        ResetPWRequest user= (ResetPWRequest) v;
        /*telNo	是	string	手机号
        password	是	string	新密码
        code	否	string	验证码*/
        RequestParams parems=new RequestParams(Constant.login_forgetPassword);
        parems.addBodyParameter("telNo",user.getTelNo());
        parems.addBodyParameter("password",user.getPassword());
        parems.addBodyParameter("code",user.getMessageCode());
        parems.addBodyParameter("clientId",Constant.CLIENT_ID);
        parems.addBodyParameter("clientSecret",Constant.CLIENT_SECRET);
        sendToServer(parems,1);
    }
}
